home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / dev / c / libiconv_src.lha / autoconf / config.guess < prev    next >
Encoding:
Text File  |  2000-11-07  |  32.5 KB  |  1,202 lines

  1. #! /bin/sh
  2. # Attempt to guess a canonical system name.
  3. #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
  4. #   Free Software Foundation, Inc.
  5. #
  6. # This file is free software; you can redistribute it and/or modify it
  7. # under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. # General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. #
  20. # As a special exception to the GNU General Public License, if you
  21. # distribute this file as part of a program that contains a
  22. # configuration script generated by Autoconf, you may include it under
  23. # the same distribution terms that you use for the rest of that program.
  24.  
  25. # Written by Per Bothner <bothner@cygnus.com>.
  26. # Please send patches to <config-patches@gnu.org>.
  27. #
  28. # Changed by Bruno Haible, 25 March 2000.
  29. # The master version of this file is in
  30. # ftp://clisp.cons.org/pub/lisp/clisp/source/.
  31. #
  32. # This script attempts to guess a canonical system name similar to
  33. # config.sub.  If it succeeds, it prints the system name on stdout, and
  34. # exits with 0.  Otherwise, it exits with 1.
  35. #
  36. # The plan is that this can be called by configure scripts if you
  37. # don't specify an explicit system type (host/target name).
  38. #
  39. # Only a few systems have been added to this list; please add others
  40. # (but try to keep the structure clean).
  41. #
  42.  
  43. # Use $HOST_CC if defined. $CC may point to a cross-compiler
  44. if test x"$CC_FOR_BUILD" = x; then
  45.   if test x"$HOST_CC" != x; then
  46.     CC_FOR_BUILD="$HOST_CC"
  47.   else
  48.     if test x"$CC" != x; then
  49.       CC_FOR_BUILD="$CC"
  50.     else
  51.       CC_FOR_BUILD=cc
  52.     fi
  53.   fi
  54. fi
  55.  
  56.  
  57. # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
  58. # (ghazi@noc.rutgers.edu 8/24/94.)
  59. if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
  60.     PATH=$PATH:/.attbin ; export PATH
  61. # This is needed to find uname on SunOS 4.0.3.
  62. elif (test -f /usr/5bin/uname) >/dev/null 2>&1 ; then
  63.     PATH=$PATH:/usr/5bin
  64. fi
  65.  
  66. UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
  67. UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
  68. UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
  69. UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
  70.  
  71. dummy=dummy-$$
  72. trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
  73.  
  74. # Note: order is significant - the case branches are not exclusive.
  75.  
  76. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
  77.     *:NetBSD:*:*)
  78.     # Netbsd (nbsd) targets should (where applicable) match one or
  79.     # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
  80.     # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
  81.     # switched to ELF, *-*-netbsd* would select the old
  82.     # object file format.  This provides both forward
  83.     # compatibility and a consistent mechanism for selecting the
  84.     # object file format.
  85.     # Determine the machine/vendor (is the vendor relevant).
  86.     case "${UNAME_MACHINE}" in
  87.         amiga) machine=m68k-cbm ;;
  88.         arm32) machine=arm-unknown ;;
  89.         atari*) machine=m68k-atari ;;
  90.         sun3*) machine=m68k-sun ;;
  91.         mac68k) machine=m68k-apple ;;
  92.         macppc) machine=powerpc-apple ;;
  93.         hp3[0-9][05]) machine=m68k-hp ;;
  94.         ibmrt|romp-ibm) machine=romp-ibm ;;
  95.         *) machine=${UNAME_MACHINE}-unknown ;;
  96.     esac
  97.     # The Operating System including object format.
  98.     if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
  99.         | grep __ELF__ >/dev/null
  100.     then
  101.         # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
  102.         # Return netbsd for either.  FIX?
  103.         os=netbsd
  104.     else
  105.         os=netbsdelf
  106.     fi
  107.     # The OS release
  108.     release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  109.     # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
  110.     # contains redundant information, the shorter form:
  111.     # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
  112.     echo "${machine}-${os}${release}"
  113.     exit 0 ;;
  114.     alpha:OSF1:*:*)
  115.     if test $UNAME_RELEASE = "V4.0"; then
  116.         UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
  117.     fi
  118.     # A Vn.n version is a released version.
  119.     # A Tn.n version is a released field test version.
  120.     # A Xn.n version is an unreleased experimental baselevel.
  121.     # 1.2 uses "1.2" for uname -r.
  122.     cat <<EOF >$dummy.s
  123.     .data
  124. \$Lformat:
  125.     .byte 37,100,45,37,120,10,0    # "%d-%x\n"
  126.  
  127.     .text
  128.     .globl main
  129.     .align 4
  130.     .ent main
  131. main:
  132.     .frame \$30,16,\$26,0
  133.     ldgp \$29,0(\$27)
  134.     .prologue 1
  135.     .long 0x47e03d80 # implver \$0
  136.     lda \$2,-1
  137.     .long 0x47e20c21 # amask \$2,\$1
  138.     lda \$16,\$Lformat
  139.     mov \$0,\$17
  140.     not \$1,\$18
  141.     jsr \$26,printf
  142.     ldgp \$29,0(\$26)
  143.     mov 0,\$16
  144.     jsr \$26,exit
  145.     .end main
  146. EOF
  147.     $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
  148.     if test "$?" = 0 ; then
  149.         case `./$dummy` in
  150.             0-0)
  151.                 UNAME_MACHINE="alpha"
  152.                 ;;
  153.             1-0)
  154.                 UNAME_MACHINE="alphaev5"
  155.                 ;;
  156.             1-1)
  157.                 UNAME_MACHINE="alphaev56"
  158.                 ;;
  159.             1-101)
  160.                 UNAME_MACHINE="alphapca56"
  161.                 ;;
  162.             2-303)
  163.                 UNAME_MACHINE="alphaev6"
  164.                 ;;
  165.             2-307)
  166.                 UNAME_MACHINE="alphaev67"
  167.                 ;;
  168.         esac
  169.     fi
  170.     rm -f $dummy.s $dummy
  171.     echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  172.     exit 0 ;;
  173.     Alpha\ *:Windows_NT*:*)
  174.     # How do we know it's Interix rather than the generic POSIX subsystem?
  175.     # Should we change UNAME_MACHINE based on the output of uname instead
  176.     # of the specific Alpha model?
  177.     echo alpha-pc-interix
  178.     exit 0 ;;
  179.     21064:Windows_NT:50:3)
  180.     echo alpha-dec-winnt3.5
  181.     exit 0 ;;
  182.     Amiga*:UNIX_System_V:4.0:*)
  183.     echo m68k-cbm-sysv4
  184.     exit 0;;
  185.     amiga:OpenBSD:*:*)
  186.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  187.     exit 0 ;;
  188.     *:[Aa]miga[Oo][Ss]:*:*)
  189.     echo ${UNAME_MACHINE}-unknown-amigaos
  190.     exit 0 ;;
  191.     arc64:OpenBSD:*:*)
  192.     echo mips64el-unknown-openbsd${UNAME_RELEASE}
  193.     exit 0 ;;
  194.     arc:OpenBSD:*:*)
  195.     echo mipsel-unknown-openbsd${UNAME_RELEASE}
  196.     exit 0 ;;
  197.     hkmips:OpenBSD:*:*)
  198.     echo mips-unknown-openbsd${UNAME_RELEASE}
  199.     exit 0 ;;
  200.     pmax:OpenBSD:*:*)
  201.     echo mipsel-unknown-openbsd${UNAME_RELEASE}
  202.     exit 0 ;;
  203.     sgi:OpenBSD:*:*)
  204.     echo mips-unknown-openbsd${UNAME_RELEASE}
  205.     exit 0 ;;
  206.     wgrisc:OpenBSD:*:*)
  207.     echo mipsel-unknown-openbsd${UNAME_RELEASE}
  208.     exit 0 ;;
  209.     *:OS/390:*:*)
  210.     echo i370-ibm-openedition
  211.     exit 0 ;;
  212.     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
  213.     echo arm-acorn-riscix${UNAME_RELEASE}
  214.     exit 0;;
  215.     SR2?01:HI-UX/MPP:*:*)
  216.     echo hppa1.1-hitachi-hiuxmpp
  217.     exit 0;;
  218.     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
  219.     # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
  220.     if test "`(/bin/universe) 2>/dev/null`" = att ; then
  221.         echo pyramid-pyramid-sysv3
  222.     else
  223.         echo pyramid-pyramid-bsd
  224.     fi
  225.     exit 0 ;;
  226.     NILE*:*:*:dcosx)
  227.     echo pyramid-pyramid-svr4
  228.     exit 0 ;;
  229.     sun4H:SunOS:5.*:*)
  230.     echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  231.     exit 0 ;;
  232.     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
  233.     echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  234.     exit 0 ;;
  235.     i86pc:SunOS:5.*:*)
  236.     echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  237.     exit 0 ;;
  238.     sun4*:SunOS:6*:*)
  239.     # According to config.sub, this is the proper way to canonicalize
  240.     # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
  241.     # it's likely to be more like Solaris than SunOS4.
  242.     echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  243.     exit 0 ;;
  244.     sun4*:SunOS:*:*)
  245.     case "`/usr/bin/arch -k`" in
  246.         Series*|S4*)
  247.         UNAME_RELEASE=`uname -v`
  248.         ;;
  249.     esac
  250.     # Japanese Language versions have a version number like `4.1.3-JL'.
  251.     echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
  252.     exit 0 ;;
  253.     sun3*:SunOS:*:* | sun:SunOS:*:*)
  254.     echo m68k-sun-sunos${UNAME_RELEASE}
  255.     exit 0 ;;
  256.     sun*:*:4.2BSD:*)
  257.     UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
  258.     test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
  259.     case "`/bin/arch`" in
  260.         sun3)
  261.         echo m68k-sun-sunos${UNAME_RELEASE}
  262.         ;;
  263.         sun4)
  264.         echo sparc-sun-sunos${UNAME_RELEASE}
  265.         ;;
  266.     esac
  267.     exit 0 ;;
  268.     aushp:SunOS:*:*)
  269.     echo sparc-auspex-sunos${UNAME_RELEASE}
  270.     exit 0 ;;
  271.     atari*:OpenBSD:*:*)
  272.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  273.     exit 0 ;;
  274.     # The situation for MiNT is a little confusing.  The machine name
  275.     # can be virtually everything (everything which is not
  276.     # "atarist" or "atariste" at least should have a processor
  277.     # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
  278.     # to the lowercase version "mint" (or "freemint").  Finally
  279.     # the system name "TOS" denotes a system which is actually not
  280.     # MiNT.  But MiNT is downward compatible to TOS, so this should
  281.     # be no problem.
  282.     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
  283.     echo m68k-atari-mint${UNAME_RELEASE}
  284.     exit 0 ;;
  285.     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
  286.     echo m68k-atari-mint${UNAME_RELEASE}
  287.     exit 0 ;;
  288.     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
  289.     echo m68k-atari-mint${UNAME_RELEASE}
  290.     exit 0 ;;
  291.     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
  292.     echo m68k-milan-mint${UNAME_RELEASE}
  293.     exit 0 ;;
  294.     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
  295.     echo m68k-hades-mint${UNAME_RELEASE}
  296.     exit 0 ;;
  297.     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
  298.     echo m68k-unknown-mint${UNAME_RELEASE}
  299.     exit 0 ;;
  300.     sun3*:OpenBSD:*:*)
  301.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  302.     exit 0 ;;
  303.     mac68k:OpenBSD:*:*)
  304.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  305.     exit 0 ;;
  306.     mvme68k:OpenBSD:*:*)
  307.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  308.     exit 0 ;;
  309.     mvme88k:OpenBSD:*:*)
  310.     echo m88k-unknown-openbsd${UNAME_RELEASE}
  311.     exit 0 ;;
  312.     powerpc:machten:*:*)
  313.     echo powerpc-apple-machten${UNAME_RELEASE}
  314.     exit 0 ;;
  315.     RISC*:Mach:*:*)
  316.     echo mips-dec-mach_bsd4.3
  317.     exit 0 ;;
  318.     RISC*:ULTRIX:*:*)
  319.     echo mips-dec-ultrix${UNAME_RELEASE}
  320.     exit 0 ;;
  321.     VAX*:ULTRIX*:*:*)
  322.     echo vax-dec-ultrix${UNAME_RELEASE}
  323.     exit 0 ;;
  324.     2020:CLIX:*:* | 2430:CLIX:*:*)
  325.     echo clipper-intergraph-clix${UNAME_RELEASE}
  326.     exit 0 ;;
  327.     mips:*:*:UMIPS | mips:*:*:RISCos)
  328.     sed 's/^    //' << EOF >$dummy.c
  329.     #if defined(__STDC__) || defined(__cplusplus)
  330.     #include <stdio.h>  /* for printf() prototype */
  331.     int main (int argc, char *argv[])
  332.     #else
  333.     main(argc, argv)
  334.     int argc;
  335.     char *argv[];
  336.     #endif
  337.     {
  338.     #if defined (host_mips) && defined (MIPSEB)
  339.     #if defined (SYSTYPE_SYSV)
  340.       printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
  341.     #endif
  342.     #if defined (SYSTYPE_SVR4)
  343.       printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
  344.     #endif
  345.     #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
  346.       printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
  347.     #endif
  348.     #endif
  349.       exit (-1);
  350.     }
  351. EOF
  352.     $CC_FOR_BUILD $dummy.c -o $dummy \
  353.       && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
  354.       && rm $dummy.c $dummy && exit 0
  355.     rm -f $dummy.c $dummy
  356.     echo mips-mips-riscos${UNAME_RELEASE}
  357.     exit 0 ;;
  358.     Night_Hawk:Power_UNIX:*:*)
  359.     echo powerpc-harris-powerunix
  360.     exit 0 ;;
  361.     m88k:CX/UX:7*:*)
  362.     echo m88k-harris-cxux7
  363.     exit 0 ;;
  364.     m88k:*:4*:R4*)
  365.     echo m88k-motorola-sysv4
  366.     exit 0 ;;
  367.     m88k:*:3*:R3*)
  368.     echo m88k-motorola-sysv3
  369.     exit 0 ;;
  370.     AViiON:dgux:*:*)
  371.     # DG/UX returns AViiON for all architectures
  372.     UNAME_PROCESSOR=`/usr/bin/uname -p`
  373.     if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110]
  374.     then
  375.         if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
  376.            [ ${TARGET_BINARY_INTERFACE}x = x ]
  377.         then
  378.         echo m88k-dg-dgux${UNAME_RELEASE}
  379.         else
  380.         echo m88k-dg-dguxbcs${UNAME_RELEASE}
  381.         fi
  382.     else
  383.         echo i586-dg-dgux${UNAME_RELEASE}
  384.     fi
  385.     exit 0 ;;
  386.     M88*:DolphinOS:*:*)    # DolphinOS (SVR3)
  387.     echo m88k-dolphin-sysv3
  388.     exit 0 ;;
  389.     M88*:*:R3*:*)
  390.     # Delta 88k system running SVR3
  391.     echo m88k-motorola-sysv3
  392.     exit 0 ;;
  393.     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
  394.     echo m88k-tektronix-sysv3
  395.     exit 0 ;;
  396.     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
  397.     echo m68k-tektronix-bsd
  398.     exit 0 ;;
  399.     *:IRIX*:*:*)
  400.     echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
  401.     exit 0 ;;
  402.     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
  403.     echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
  404.     exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
  405.     i?86:AIX:*:*)
  406.     echo i386-ibm-aix
  407.     exit 0 ;;
  408.     *:AIX:2:3)
  409.     if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
  410.         sed 's/^        //' << EOF >$dummy.c
  411.         #include <sys/systemcfg.h>
  412.  
  413.         main()
  414.             {
  415.             if (!__power_pc())
  416.                 exit(1);
  417.             puts("powerpc-ibm-aix3.2.5");
  418.             exit(0);
  419.             }
  420. EOF
  421.         $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
  422.         rm -f $dummy.c $dummy
  423.         echo rs6000-ibm-aix3.2.5
  424.     elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
  425.         echo rs6000-ibm-aix3.2.4
  426.     else
  427.         echo rs6000-ibm-aix3.2
  428.     fi
  429.     exit 0 ;;
  430.     *:AIX:*:4)
  431.     IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
  432.     if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
  433.         IBM_ARCH=rs6000
  434.     else
  435.         IBM_ARCH=powerpc
  436.     fi
  437.     if [ -x /usr/bin/oslevel ] ; then
  438.         IBM_REV=`/usr/bin/oslevel`
  439.     else
  440.         IBM_REV=4.${UNAME_RELEASE}
  441.     fi
  442.     echo ${IBM_ARCH}-ibm-aix${IBM_REV}
  443.     exit 0 ;;
  444.     *:AIX:*:*)
  445.     echo rs6000-ibm-aix
  446.     exit 0 ;;
  447.     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
  448.     echo romp-ibm-bsd4.4
  449.     exit 0 ;;
  450.     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
  451.     echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
  452.     exit 0 ;;                           # report: romp-ibm BSD 4.3
  453.     *:BOSX:*:*)
  454.     echo rs6000-bull-bosx
  455.     exit 0 ;;
  456.     DPX/2?00:B.O.S.:*:*)
  457.     echo m68k-bull-sysv3
  458.     exit 0 ;;
  459.     9000/[34]??:4.3bsd:1.*:*)
  460.     echo m68k-hp-bsd
  461.     exit 0 ;;
  462.     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
  463.     echo m68k-hp-bsd4.4
  464.     exit 0 ;;
  465.     9000/[34678]??:HP-UX:*:*)
  466.     case "${UNAME_MACHINE}" in
  467.         9000/31? )            HP_ARCH=m68000 ;;
  468.         9000/[34]?? )         HP_ARCH=m68k ;;
  469.         9000/[678][0-9][0-9])
  470.               sed 's/^              //' << EOF >$dummy.c
  471.               #define _HPUX_SOURCE
  472.               #include <stdlib.h>
  473.               #include <unistd.h>
  474.               
  475.               int main ()
  476.               {
  477.               #if defined(_SC_KERNEL_BITS)
  478.                   long bits = sysconf(_SC_KERNEL_BITS);
  479.               #endif
  480.                   long cpu  = sysconf (_SC_CPU_VERSION);
  481.               
  482.                   switch (cpu)
  483.                   {
  484.                   case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
  485.                   case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
  486.                   case CPU_PA_RISC2_0:
  487.               #if defined(_SC_KERNEL_BITS)
  488.                       switch (bits)
  489.                       {
  490.                       case 64: puts ("hppa2.0w"); break;
  491.                       case 32: puts ("hppa2.0n"); break;
  492.                       default: puts ("hppa2.0"); break;
  493.                       } break;
  494.               #else  /* !defined(_SC_KERNEL_BITS) */
  495.                       puts ("hppa2.0"); break;
  496.               #endif
  497.                   default: puts ("hppa1.0"); break;
  498.                   }
  499.                   exit (0);
  500.               }
  501. EOF
  502.     (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
  503.     rm -f $dummy.c $dummy
  504.     esac
  505.     HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
  506.     echo ${HP_ARCH}-hp-hpux${HPUX_REV}
  507.     exit 0 ;;
  508.     3050*:HI-UX:*:*)
  509.     sed 's/^    //' << EOF >$dummy.c
  510.     #include <unistd.h>
  511.     int
  512.     main ()
  513.     {
  514.       long cpu = sysconf (_SC_CPU_VERSION);
  515.       /* The order matters, because CPU_IS_HP_MC68K erroneously returns
  516.          true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
  517.          results, however.  */
  518.       if (CPU_IS_PA_RISC (cpu))
  519.         {
  520.           switch (cpu)
  521.         {
  522.           case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
  523.           case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
  524.           case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
  525.           default: puts ("hppa-hitachi-hiuxwe2"); break;
  526.         }
  527.         }
  528.       else if (CPU_IS_HP_MC68K (cpu))
  529.         puts ("m68k-hitachi-hiuxwe2");
  530.       else puts ("unknown-hitachi-hiuxwe2");
  531.       exit (0);
  532.     }
  533. EOF
  534.     $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
  535.     rm -f $dummy.c $dummy
  536.     echo unknown-hitachi-hiuxwe2
  537.     exit 0 ;;
  538.     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
  539.     echo hppa1.1-hp-bsd
  540.     exit 0 ;;
  541.     9000/8??:4.3bsd:*:*)
  542.     echo hppa1.0-hp-bsd
  543.     exit 0 ;;
  544.     *9??*:MPE/iX:*:*)
  545.     echo hppa1.0-hp-mpeix
  546.     exit 0 ;;
  547.     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
  548.     echo hppa1.1-hp-osf
  549.     exit 0 ;;
  550.     hp8??:OSF1:*:*)
  551.     echo hppa1.0-hp-osf
  552.     exit 0 ;;
  553.     i?86:OSF1:*:*)
  554.     if [ -x /usr/sbin/sysversion ] ; then
  555.         echo ${UNAME_MACHINE}-unknown-osf1mk
  556.     else
  557.         echo ${UNAME_MACHINE}-unknown-osf1
  558.     fi
  559.     exit 0 ;;
  560.     parisc*:Lites*:*:*)
  561.     echo hppa1.1-hp-lites
  562.     exit 0 ;;
  563.     hppa*:OpenBSD:*:*)
  564.     echo hppa-unknown-openbsd
  565.     exit 0 ;;
  566.     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
  567.     echo c1-convex-bsd
  568.     exit 0 ;;
  569.     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
  570.     if getsysinfo -f scalar_acc
  571.     then echo c32-convex-bsd
  572.     else echo c2-convex-bsd
  573.     fi
  574.     exit 0 ;;
  575.     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
  576.     echo c34-convex-bsd
  577.     exit 0 ;;
  578.     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
  579.     echo c38-convex-bsd
  580.     exit 0 ;;
  581.     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
  582.     echo c4-convex-bsd
  583.     exit 0 ;;
  584.     CRAY*X-MP:*:*:*)
  585.     echo xmp-cray-unicos
  586.     exit 0 ;;
  587.     CRAY*Y-MP:*:*:*)
  588.     echo ymp-cray-unicos${UNAME_RELEASE}
  589.     exit 0 ;;
  590.     CRAY*[A-Z]90:*:*:*)
  591.     echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
  592.     | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
  593.           -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
  594.     exit 0 ;;
  595.     CRAY*TS:*:*:*)
  596.     echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
  597.     exit 0 ;;
  598.     CRAY*T3E:*:*:*)
  599.     echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
  600.     exit 0 ;;
  601.     CRAY*SV1:*:*:*)
  602.     echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
  603.     exit 0 ;;
  604.     CRAY-2:*:*:*)
  605.     echo cray2-cray-unicos
  606.     exit 0 ;;
  607.     F300:UNIX_System_V:*:*)
  608.         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
  609.     FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
  610.     echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
  611.     exit 0 ;;
  612.     F301:UNIX_System_V:*:*)
  613.     echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
  614.     exit 0 ;;
  615.     hp300:OpenBSD:*:*)
  616.     echo m68k-unknown-openbsd${UNAME_RELEASE}
  617.     exit 0 ;;
  618.     i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
  619.     echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
  620.     exit 0 ;;
  621.     sparc*:BSD/OS:*:*)
  622.     echo sparc-unknown-bsdi${UNAME_RELEASE}
  623.     exit 0 ;;
  624.     *:BSD/OS:*:*)
  625.     echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
  626.     exit 0 ;;
  627.     *:FreeBSD:*:*)
  628.     if test -x /usr/bin/objformat; then
  629.         if test "elf" = "`/usr/bin/objformat`"; then
  630.         echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
  631.         exit 0
  632.         fi
  633.     fi
  634.     echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
  635.     exit 0 ;;
  636.     *:OpenBSD:*:*)
  637.     echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  638.     exit 0 ;;
  639.     i*:CYGWIN*:*)
  640.     echo ${UNAME_MACHINE}-pc-cygwin
  641.     exit 0 ;;
  642.     i*:MINGW*:*)
  643.     echo ${UNAME_MACHINE}-pc-mingw32
  644.     exit 0 ;;
  645.     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
  646.     # How do we know it's Interix rather than the generic POSIX subsystem?
  647.     # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
  648.     # UNAME_MACHINE based on the output of uname instead of i386?
  649.     echo i386-pc-interix
  650.     exit 0 ;;
  651.     i*:UWIN*:*)
  652.     echo ${UNAME_MACHINE}-pc-uwin
  653.     exit 0 ;;
  654.     p*:CYGWIN*:*)
  655.     echo powerpcle-unknown-cygwin
  656.     exit 0 ;;
  657.     prep*:SunOS:5.*:*)
  658.     echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
  659.     exit 0 ;;
  660.     *:GNU:*:*)
  661.     echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
  662.     exit 0 ;;
  663.     *:Linux:*:*)
  664.  
  665.     # The BFD linker knows what the default object file format is, so
  666.     # first see if it will tell us. cd to the root directory to prevent
  667.     # problems with other programs or directories called `ld' in the path.
  668.     ld_help_string=`cd /; ld --help 2>&1`
  669.     ld_supported_emulations=`echo $ld_help_string \
  670.              | sed -ne '/supported emulations:/!d
  671.                     s/[     ][     ]*/ /g
  672.                     s/.*supported emulations: *//
  673.                     s/ .*//
  674.                     p'`
  675.     case "$ld_supported_emulations" in
  676.       *ia64)
  677.         echo "${UNAME_MACHINE}-unknown-linux"
  678.         exit 0
  679.         ;;
  680.       i?86linux)
  681.         echo "${UNAME_MACHINE}-pc-linuxaout"
  682.         exit 0
  683.         ;;
  684.       i?86coff)
  685.         echo "${UNAME_MACHINE}-pc-linuxcoff"
  686.         exit 0
  687.         ;;
  688.       sparclinux)
  689.         echo "${UNAME_MACHINE}-unknown-linuxaout"
  690.         exit 0
  691.         ;;
  692.       armlinux)
  693.         echo "${UNAME_MACHINE}-unknown-linuxaout"
  694.         exit 0
  695.         ;;
  696.       elf32arm*)
  697.         echo "${UNAME_MACHINE}-unknown-linuxoldld"
  698.         exit 0
  699.         ;;
  700.       armelf_linux*)
  701.         echo "${UNAME_MACHINE}-unknown-linux"
  702.         exit 0
  703.         ;;
  704.       m68klinux)
  705.         echo "${UNAME_MACHINE}-unknown-linuxaout"
  706.         exit 0
  707.         ;;
  708.       elf32ppc | elf32ppclinux)
  709.         # Determine Lib Version
  710.         cat >$dummy.c <<EOF
  711. #include <features.h>
  712. #if defined(__GLIBC__)
  713. extern char __libc_version[];
  714. extern char __libc_release[];
  715. #endif
  716. main(argc, argv)
  717.      int argc;
  718.      char *argv[];
  719. {
  720. #if defined(__GLIBC__)
  721.   printf("%s %s\n", __libc_version, __libc_release);
  722. #else
  723.   printf("unknown\n");
  724. #endif
  725.   return 0;
  726. }
  727. EOF
  728.         LIBC=""
  729.         $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
  730.         if test "$?" = 0 ; then
  731.             ./$dummy | grep 1\.99 > /dev/null
  732.             if test "$?" = 0 ; then
  733.                 LIBC="libc1"
  734.             fi
  735.         fi
  736.         rm -f $dummy.c $dummy
  737.         echo powerpc-unknown-linux${LIBC}
  738.         exit 0
  739.         ;;
  740.       elf_s390)
  741.         echo "${UNAME_MACHINE}-ibm-linux"
  742.         exit 0
  743.         ;;
  744.     esac
  745.  
  746.     if test "${UNAME_MACHINE}" = "alpha" ; then
  747.         sed 's/^        //'  <<EOF >$dummy.s
  748.             .data
  749.         \$Lformat:
  750.             .byte 37,100,45,37,120,10,0    # "%d-%x\n"
  751.  
  752.             .text
  753.             .globl main
  754.             .align 4
  755.             .ent main
  756.         main:
  757.             .frame \$30,16,\$26,0
  758.             ldgp \$29,0(\$27)
  759.             .prologue 1
  760.             .long 0x47e03d80 # implver \$0
  761.             lda \$2,-1
  762.             .long 0x47e20c21 # amask \$2,\$1
  763.             lda \$16,\$Lformat
  764.             mov \$0,\$17
  765.             not \$1,\$18
  766.             jsr \$26,printf
  767.             ldgp \$29,0(\$26)
  768.             mov 0,\$16
  769.             jsr \$26,exit
  770.             .end main
  771. EOF
  772.         LIBC="libc6"
  773.         $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
  774.         if test "$?" = 0 ; then
  775.             case `./$dummy` in
  776.             0-0)
  777.                 UNAME_MACHINE="alpha"
  778.                 ;;
  779.             1-0)
  780.                 UNAME_MACHINE="alphaev5"
  781.                 ;;
  782.             1-1)
  783.                 UNAME_MACHINE="alphaev56"
  784.                 ;;
  785.             1-101)
  786.                 UNAME_MACHINE="alphapca56"
  787.                 ;;
  788.             2-303)
  789.                 UNAME_MACHINE="alphaev6"
  790.                 ;;
  791.             2-307)
  792.                 UNAME_MACHINE="alphaev67"
  793.                 ;;
  794.             esac
  795.  
  796.             objdump --private-headers $dummy | \
  797.               grep ld.so.1 > /dev/null
  798.             if test "$?" = 0 ; then
  799.                 LIBC="libc5"
  800.             fi
  801.         fi
  802.         rm -f $dummy.s $dummy
  803.         echo ${UNAME_MACHINE}-unknown-linux${LIBC} ; exit 0
  804.     elif test "${UNAME_MACHINE}" = "mips" ; then
  805.       cat >$dummy.c <<EOF
  806. #if defined(__STDC__) || defined(__cplusplus)
  807. #include <stdio.h>  /* for printf() prototype */
  808. int main (int argc, char *argv[])
  809. #else
  810. main(argc, argv)
  811.      int argc;
  812.      char *argv[];
  813. #endif
  814. {
  815. #ifdef __MIPSEB__
  816.   printf ("%s-unknown-linuxlibc6\n", argv[1]);
  817. #endif
  818. #ifdef __MIPSEL__
  819.   printf ("%sel-unknown-linuxlibc6\n", argv[1]);
  820. #endif
  821.   return 0;
  822. }
  823. EOF
  824.       $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
  825.       rm -f $dummy.c $dummy
  826.     elif test "${UNAME_MACHINE}" = "s390"; then
  827.       echo s390-ibm-linux && exit 0
  828.     else
  829.       # Either a pre-BFD a.out linker (linuxoldld)
  830.       # or one that does not give us useful --help.
  831.       # GCC wants to distinguish between linuxoldld and linuxaout.
  832.       # If ld does not provide *any* "supported emulations:"
  833.       # that means it is gnuoldld.
  834.       echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
  835.       test $? != 0 && echo "${UNAME_MACHINE}-pc-linuxoldld" && exit 0
  836.  
  837.       case "${UNAME_MACHINE}" in
  838.       i?86)
  839.         VENDOR=pc;
  840.         ;;
  841.       *)
  842.         VENDOR=unknown;
  843.         ;;
  844.       esac
  845.       # Determine whether the default compiler is a.out or elf
  846.       cat >$dummy.c <<EOF
  847. #include <features.h>
  848. #if defined(__STDC__) || defined(__cplusplus)
  849. #include <stdio.h>  /* for printf() prototype */
  850. int main (int argc, char *argv[])
  851. #else
  852. main(argc, argv)
  853.      int argc;
  854.      char *argv[];
  855. #endif
  856. {
  857. #ifdef __ELF__
  858. # ifdef __GLIBC__
  859. #  if __GLIBC__ >= 2
  860.     printf ("%s-${VENDOR}-linuxlibc6\n", argv[1]);
  861. #  else
  862.     printf ("%s-${VENDOR}-linuxlibc5\n", argv[1]);
  863. #  endif
  864. # else
  865.    printf ("%s-${VENDOR}-linuxlibc5\n", argv[1]);
  866. # endif
  867. #else
  868.   printf ("%s-${VENDOR}-linuxaout\n", argv[1]);
  869. #endif
  870.   return 0;
  871. }
  872. EOF
  873.       $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
  874.       rm -f $dummy.c $dummy
  875.     fi ;;
  876. # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
  877. # are messed up and put the nodename in both sysname and nodename.
  878.     i?86:DYNIX/ptx:4*:*)
  879.     echo i386-sequent-sysv4
  880.     exit 0 ;;
  881.     i?86:UNIX_SV:4.2MP:2.*)
  882.         # Unixware is an offshoot of SVR4, but it has its own version
  883.         # number series starting with 2...
  884.         # I am not positive that other SVR4 systems won't match this,
  885.     # I just have to hope.  -- rms.
  886.         # Use sysv4.2uw... so that sysv4* matches it.
  887.     echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
  888.     exit 0 ;;
  889.     i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
  890.     UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
  891.     if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
  892.         echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
  893.     else
  894.         echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
  895.     fi
  896.     exit 0 ;;
  897.     i?86:*:5:7*)
  898.     # Fixed at (any) Pentium or better
  899.     UNAME_MACHINE=i586
  900.     if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
  901.         echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
  902.     else
  903.         echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
  904.     fi
  905.     exit 0 ;;
  906.     i?86:*:3.2:*)
  907.     if test -f /usr/options/cb.name; then
  908.         UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
  909.         echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
  910.     elif /bin/uname -X 2>/dev/null >/dev/null ; then
  911.         UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
  912.         (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
  913.         (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
  914.             && UNAME_MACHINE=i586
  915.         (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
  916.             && UNAME_MACHINE=i686
  917.         (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
  918.             && UNAME_MACHINE=i686
  919.         echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
  920.     else
  921.         echo ${UNAME_MACHINE}-pc-sysv32
  922.     fi
  923.     exit 0 ;;
  924.     i?86:*DOS:*:*)
  925.     echo ${UNAME_MACHINE}-pc-msdosdjgpp
  926.     exit 0 ;;
  927.     pc:*:*:*)
  928.     # Left here for compatibility:
  929.     # uname -m prints for DJGPP always 'pc', but it prints nothing about
  930.     # the processor, so we play safe by assuming i386.
  931.     echo i386-pc-msdosdjgpp
  932.         exit 0 ;;
  933.     Intel:Mach:3*:*)
  934.     echo i386-pc-mach3
  935.     exit 0 ;;
  936.     paragon:*:*:*)
  937.     echo i860-intel-osf1
  938.     exit 0 ;;
  939.     i860:*:4.*:*) # i860-SVR4
  940.     if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
  941.       echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
  942.     else # Add other i860-SVR4 vendors below as they are discovered.
  943.       echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
  944.     fi
  945.     exit 0 ;;
  946.     mini*:CTIX:SYS*5:*)
  947.     # "miniframe"
  948.     echo m68010-convergent-sysv
  949.     exit 0 ;;
  950.     M68*:*:R3V[567]*:*)
  951.     test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
  952.     3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
  953.     OS_REL=''
  954.     test -r /etc/.relid \
  955.     && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
  956.     /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
  957.       && echo i486-ncr-sysv4.3${OS_REL} && exit 0
  958.     /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
  959.       && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
  960.     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
  961.     /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
  962.       && echo i486-ncr-sysv4 && exit 0 ;;
  963.     m68*:LynxOS:2.*:*)
  964.     echo m68k-unknown-lynxos${UNAME_RELEASE}
  965.     exit 0 ;;
  966.     mc68030:UNIX_System_V:4.*:*)
  967.     echo m68k-atari-sysv4
  968.     exit 0 ;;
  969.     i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
  970.     echo i386-unknown-lynxos${UNAME_RELEASE}
  971.     exit 0 ;;
  972.     TSUNAMI:LynxOS:2.*:*)
  973.     echo sparc-unknown-lynxos${UNAME_RELEASE}
  974.     exit 0 ;;
  975.     rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
  976.     echo rs6000-unknown-lynxos${UNAME_RELEASE}
  977.     exit 0 ;;
  978.     SM[BE]S:UNIX_SV:*:*)
  979.     echo mips-dde-sysv${UNAME_RELEASE}
  980.     exit 0 ;;
  981.     RM*:ReliantUNIX-*:*:*)
  982.     echo mips-sni-sysv4
  983.     exit 0 ;;
  984.     RM*:SINIX-*:*:*)
  985.     echo mips-sni-sysv4
  986.     exit 0 ;;
  987.     *:SINIX-*:*:*)
  988.     if uname -p 2>/dev/null >/dev/null ; then
  989.         UNAME_MACHINE=`(uname -p) 2>/dev/null`
  990.         echo ${UNAME_MACHINE}-sni-sysv4
  991.     else
  992.         echo ns32k-sni-sysv
  993.     fi
  994.     exit 0 ;;
  995.     PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
  996.                            # says <Richard.M.Bartel@ccMail.Census.GOV>
  997.         echo i586-unisys-sysv4
  998.         exit 0 ;;
  999.     *:UNIX_System_V:4*:FTX*)
  1000.     # From Gerald Hewes <hewes@openmarket.com>.
  1001.     # How about differentiating between stratus architectures? -djm
  1002.     echo hppa1.1-stratus-sysv4
  1003.     exit 0 ;;
  1004.     *:*:*:FTX*)
  1005.     # From seanf@swdc.stratus.com.
  1006.     echo i860-stratus-sysv4
  1007.     exit 0 ;;
  1008.     mc68*:A/UX:*:*)
  1009.     echo m68k-apple-aux${UNAME_RELEASE}
  1010.     exit 0 ;;
  1011.     news*:NEWS-OS:*:6*)
  1012.     echo mips-sony-newsos6
  1013.     exit 0 ;;
  1014.     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
  1015.     if [ -d /usr/nec ]; then
  1016.             echo mips-nec-sysv${UNAME_RELEASE}
  1017.     else
  1018.             echo mips-unknown-sysv${UNAME_RELEASE}
  1019.     fi
  1020.     exit 0 ;;
  1021.     BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
  1022.     echo powerpc-be-beos
  1023.     exit 0 ;;
  1024.     BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
  1025.     echo powerpc-apple-beos
  1026.     exit 0 ;;
  1027.     BePC:BeOS:*:*)    # BeOS running on Intel PC compatible.
  1028.     echo i586-pc-beos
  1029.     exit 0 ;;
  1030.     SX-4:SUPER-UX:*:*)
  1031.     echo sx4-nec-superux${UNAME_RELEASE}
  1032.     exit 0 ;;
  1033.     SX-5:SUPER-UX:*:*)
  1034.     echo sx5-nec-superux${UNAME_RELEASE}
  1035.     exit 0 ;;
  1036.     Power*:Rhapsody:*:*)
  1037.     echo powerpc-apple-rhapsody${UNAME_RELEASE}
  1038.     exit 0 ;;
  1039.     *:Rhapsody:*:*)
  1040.     echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
  1041.     exit 0 ;;
  1042.     Power*:Mac*OS:*:*)
  1043.     echo powerpc-apple-macos${UNAME_RELEASE}
  1044.     exit 0 ;;
  1045.     *:Mac*OS:*:*)
  1046.     echo ${UNAME_MACHINE}-apple-macos${UNAME_RELEASE}
  1047.     exit 0 ;;
  1048.     *:procnto*:*:* | *:QNX:[0123456789]*:*)
  1049.     if test "${UNAME_MACHINE}" = "x86pc"; then
  1050.         UNAME_MACHINE=pc
  1051.     fi
  1052.     echo `uname -p`-${UNAME_MACHINE}-nto-qnx
  1053.     exit 0;;
  1054.     *:QNX:*:4*)
  1055.     echo i386-pc-qnx
  1056.     exit 0 ;;
  1057.     NSR-W:NONSTOP_KERNEL:*:*)
  1058.     echo nsr-tandem-nsk${UNAME_RELEASE}
  1059.     exit 0 ;;
  1060. esac
  1061.  
  1062. #echo '(No uname command or uname output not recognized.)' 1>&2
  1063. #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
  1064.  
  1065. cat >$dummy.c <<EOF
  1066. #ifdef _SEQUENT_
  1067. # include <sys/types.h>
  1068. # include <sys/utsname.h>
  1069. #endif
  1070. main ()
  1071. {
  1072. #if defined (sony)
  1073. #if defined (MIPSEB)
  1074.   /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
  1075.      I don't know....  */
  1076.   printf ("mips-sony-bsd\n"); exit (0);
  1077. #else
  1078. #include <sys/param.h>
  1079.   printf ("m68k-sony-newsos%s\n",
  1080. #ifdef NEWSOS4
  1081.           "4"
  1082. #else
  1083.       ""
  1084. #endif
  1085.          ); exit (0);
  1086. #endif
  1087. #endif
  1088.  
  1089. #if defined (__arm) && defined (__acorn) && defined (__unix)
  1090.   printf ("arm-acorn-riscix"); exit (0);
  1091. #endif
  1092.  
  1093. #if defined (hp300) && !defined (hpux)
  1094.   printf ("m68k-hp-bsd\n"); exit (0);
  1095. #endif
  1096.  
  1097. #if defined (NeXT)
  1098. #if !defined (__ARCHITECTURE__)
  1099. #define __ARCHITECTURE__ "m68k"
  1100. #endif
  1101.   int version;
  1102.   version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
  1103.   if (version < 4)
  1104.     printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
  1105.   else
  1106.     printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
  1107.   exit (0);
  1108. #endif
  1109.  
  1110. #if defined (MULTIMAX) || defined (n16)
  1111. #if defined (UMAXV)
  1112.   printf ("ns32k-encore-sysv\n"); exit (0);
  1113. #else
  1114. #if defined (CMU)
  1115.   printf ("ns32k-encore-mach\n"); exit (0);
  1116. #else
  1117.   printf ("ns32k-encore-bsd\n"); exit (0);
  1118. #endif
  1119. #endif
  1120. #endif
  1121.  
  1122. #if defined (__386BSD__)
  1123.   printf ("i386-pc-bsd\n"); exit (0);
  1124. #endif
  1125.  
  1126. #if defined (sequent)
  1127. #if defined (i386)
  1128.   printf ("i386-sequent-dynix\n"); exit (0);
  1129. #endif
  1130. #if defined (ns32000)
  1131.   printf ("ns32k-sequent-dynix\n"); exit (0);
  1132. #endif
  1133. #endif
  1134.  
  1135. #if defined (_SEQUENT_)
  1136.     struct utsname un;
  1137.  
  1138.     uname(&un);
  1139.  
  1140.     if (strncmp(un.version, "V2", 2) == 0) {
  1141.     printf ("i386-sequent-ptx2\n"); exit (0);
  1142.     }
  1143.     if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
  1144.     printf ("i386-sequent-ptx1\n"); exit (0);
  1145.     }
  1146.     printf ("i386-sequent-ptx\n"); exit (0);
  1147.  
  1148. #endif
  1149.  
  1150. #if defined (vax)
  1151. #if !defined (ultrix)
  1152.   printf ("vax-dec-bsd\n"); exit (0);
  1153. #else
  1154.   printf ("vax-dec-ultrix\n"); exit (0);
  1155. #endif
  1156. #endif
  1157.  
  1158. #if defined (alliant) && defined (i860)
  1159.   printf ("i860-alliant-bsd\n"); exit (0);
  1160. #endif
  1161.  
  1162.   exit (1);
  1163. }
  1164. EOF
  1165.  
  1166. $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
  1167. rm -f $dummy.c $dummy
  1168.  
  1169. # Apollos put the system type in the environment.
  1170.  
  1171. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
  1172.  
  1173. # Convex versions that predate uname can use getsysinfo(1)
  1174.  
  1175. if [ -x /usr/convex/getsysinfo ]
  1176. then
  1177.     case `getsysinfo -f cpu_type` in
  1178.     c1*)
  1179.     echo c1-convex-bsd
  1180.     exit 0 ;;
  1181.     c2*)
  1182.     if getsysinfo -f scalar_acc
  1183.     then echo c32-convex-bsd
  1184.     else echo c2-convex-bsd
  1185.     fi
  1186.     exit 0 ;;
  1187.     c34*)
  1188.     echo c34-convex-bsd
  1189.     exit 0 ;;
  1190.     c38*)
  1191.     echo c38-convex-bsd
  1192.     exit 0 ;;
  1193.     c4*)
  1194.     echo c4-convex-bsd
  1195.     exit 0 ;;
  1196.     esac
  1197. fi
  1198.  
  1199. #echo '(Unable to guess system type)' 1>&2
  1200.  
  1201. exit 1
  1202.